/*
 * $Id: TaskCategoryInfoDAO.java,v 1.9 2009/07/27 15:28:12 oliver Exp $
 * 
 * Copyright (C) 2006 General Electric Company. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 * 
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package com.ge.healthcare.autosc.common.database.dao;

import org.springmodules.cache.annotations.Cacheable;

import com.ge.healthcare.autosc.common.database.pojo.CfgTaskCategoryInfo;
import com.ge.healthcare.autosc.common.database.pojo.CfgTaskType;

/**
 * @author 212042764
 * 
 */
public class TaskCategoryInfoDAO extends BaseDAO implements
		ITaskCategoryInfoDAO {

	/**
	 * Eclipse generated
	 */
	private static final long serialVersionUID = 1223934394922651267L;
	private ITaskTypeDAO taskTypeDAO = null;

	protected TaskCategoryInfoDAO() {
		super(CfgTaskCategoryInfo.TABLE_NAME);
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.BaseDAO#save(java.lang.Object)
	 */
	public void save(Object pojo) {
		super.save(pojo);
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.IRequestTypeDAO#saveAlways(java.lang.Object)
	 */
	public void saveAlways(Object pojo) {
		super.save(pojo);
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.BaseDAO#deleteByID(java.lang.Object)
	 */
	public void deleteByID(Object pojo) {
		super.deleteByID(pojo);
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.BaseDAO#refresh(java.lang.Object)
	 */
	public void refresh(Object pojo) {
		super.refresh(pojo);
	}

	/**
	 * Returns task category based on id
	 * 
	 * @see com.ge.healthcare.autosc.common.database.dao.ITaskCategoryInfoDAO#getByTaskCategoryId(java.lang.Long)
	 */
	@Cacheable(modelId = "TaskCategoryInfoDAOCacheModel")
	public CfgTaskCategoryInfo getByTaskCategoryId(Long taskCategoryId) {
		return (CfgTaskCategoryInfo) findObjectByID(
				CfgTaskCategoryInfo.COL_TASK_CATEGORY_ID, taskCategoryId);
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.ITaskCategoryInfoDAO#getTaskCategoryForTaskType(java.lang.String)
	 */
	@Cacheable(modelId = "TaskCategoryInfoDAOCacheModel")
	public CfgTaskCategoryInfo getTaskCategoryForTaskType(String taskTypeName) {
		CfgTaskType taskType = taskTypeDAO.getByName(taskTypeName);
		return this.getByTaskCategoryId(taskType.getTaskCategoryId());
	}

	/**
	 * 
	 * @seecom.ge.healthcare.autosc.common.database.dao.ITaskCategoryInfoDAO#
	 * getTaskCategoryByName(java.lang.String)
	 */
	@Cacheable(modelId = "TaskCategoryInfoDAOCacheModel")
	public CfgTaskCategoryInfo getTaskCategoryByName(String taskCategory) {
		return (CfgTaskCategoryInfo) findObjectByID(
				CfgTaskCategoryInfo.COL_TASK_CATEGORY, taskCategory);
	}

	/**
	 * @param taskTypeDAO
	 *            the taskTypeDAO to set
	 */
	public void setTaskTypeDAO(ITaskTypeDAO taskTypeDAO) {
		this.taskTypeDAO = taskTypeDAO;
	}
}
